<template>
  <div>
    Home页
    <button @click="add(2)">+</button>
    {{ num }}
    {{ num2 }}
    {{ num3 }}
    <button @click="reduce(4)">+</button>
    <van-button type="info">信息按钮</van-button>
  </div>
</template>

<script>
import { mapState, mapMutations } from 'vuex'
export default {
  methods: {
    add () {
      // this.$store.dispatch('add_num')
      // this.add_num();
      // this.$store.commit('addNum',2)
      // this.$store.commit('a/addNum',2)
      // this.$store.commit('b/addNum',2)
      // this['a/addNum'](3);
      // this['b/addNum'](5);
      this.addNum(5)
    },
    reduce () {

    },
    // ...mapActions(['add_num'])
    // ...mapMutations(['a/addNum','b/addNum'])
    ...mapMutations('a',['addNum'])
  },
  mounted(){
    //console.log(this.$store)
  },
  computed: {
    // ...mapState(['num'])
    ...mapState({
      num : (state)=>state.num,
      num2 : (state)=>state.a.num,
      num3: (state)=> state.b.num
    })
  }
}
</script>

<style lang="scss" scoped>

</style>
